#! /bin/bash

branch=`git branch | grep "*" | tr -d "[:space:]*"`
dateTag=`date +"%Y%m%d%H%M%S"`
echo "当前分支为:"${branch}
echo ------------------------------------
if test $# -ge 2; then
    head=$1_${branch}_$2_
else
    head=${branch}_
fi

tag=${head}${dateTag}
git tag -a ${tag} -m "auto tag"
git push origin ${tag}
echo ------------------------------------
echo "生成的tag为："${tag}
